package org.sjs.dreamfly.data

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import java.lang.reflect.Type

@Deprecated("去掉此类封装")
object DataCenter {

    interface DataProvider

    private val dataProviderMap: MutableMap<String, DataProvider> = mutableMapOf()

    fun <T : DataProvider> getDataProvider(clazz: Class<T>): T {
        dataProviderMap[clazz.canonicalName]?.let {
            return it as T
        }
        clazz.newInstance().apply {
            dataProviderMap[clazz.canonicalName] = this
            return this
        }
    }
}